package mid

import "sort"

func MinRectanglesToCoverPoints(points [][]int, w int) int {
	sort.Slice(points, func(i, j int) bool {
		return points[i][0] < points[j][0]
	})
	count := 1
	left := points[0][0]
	for i := 1; i < len(points); i++ {
		if left+w < points[i][0] {
			count++
			left = points[i][0]
		}
	}
	return count
}
